/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.oalam.bookstore.dao;

import com.oalam.bookstore.domain.books.Author;
import com.oalam.bookstore.domain.books.Book;
import com.oalam.bookstore.domain.shopping.AbstractPrice;
import com.oalam.bookstore.domain.shopping.Price;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Administrateur
 */
public class MockBookDao implements BookDao {

    @Override
    public List<Book> findBookByTitle(String title) {
        List<Book> result = new ArrayList<Book>();

        if (title.contains("Potter")) {
            result.add(new Book("Harry Potter and the Philosopher's Stone"));
            result.add(new Book("Harry Potter and the Chamber of Secrets"));
            result.add(new Book("Harry Potter and the Prisoner of Azkaban"));
            result.add(new Book("Harry Potter and the Goblet of Fire"));
            result.add(new Book("Harry Potter and the Order of the Phoenix"));
            result.add(new Book("Harry Potter and the Half-Blood Prince"));
            result.add(new Book("Harry Potter and the Deathly Hallows"));
        }
       
        for (Book book : result) {
            AbstractPrice p = new Price(9.66);
            
            book.setPrice(p);
        }

        return result;

    }

    @Override
    public List<Book> findBookByAuthor(Author a) {
        List<Book> result = new ArrayList<Book>();

        
        if (a.getName().contains("Rowling")) {
            result.add(new Book("Harry Potter and the Philosopher's Stone"));
            result.add(new Book("Harry Potter and the Chamber of Secrets"));
            result.add(new Book("Harry Potter and the Prisoner of Azkaban"));
            result.add(new Book("Harry Potter and the Goblet of Fire"));
            result.add(new Book("Harry Potter and the Order of the Phoenix"));
            result.add(new Book("Harry Potter and the Half-Blood Prince"));
            result.add(new Book("Harry Potter and the Deathly Hallows"));
        }

        return result;
    }
}
